package pattern.platform;

import pattern.platform.aliyun.AliSmsHandler;

/**
 * 平台
 */
public enum SmsPlatform {
    /**
     *
     */
    ALIYUN("aliyun", AliSmsHandler.class);

    SmsPlatform(String platform, Class<? extends SendSmsBase> clazz) {
        this.platform = platform;
        this.clazz = clazz;
    }

    private String platform;
    private Class<? extends SendSmsBase> clazz;

    public String getPlatform() {
        return this.platform;
    }

    public Class<? extends SendSmsBase> getClazz() {
        return this.clazz;
    }

    public static Class<? extends SendSmsBase> getClazz(String platform) {
        for (var value : SmsPlatform.values()) {
            if (value.platform.equals(platform)) {
                return value.clazz;
            }
        }
        return null;
    }
}
